{extend name="base" /} {block name="css"}
<link rel="stylesheet" href="__CSS__/reply.css"> 
{/block} 
{block name="body"}
<div class="layui-body">
    <!--tab标签-->
    <div class="layui-tab layui-tab-brief">
        <ul class="layui-tab-title">
            <li class=""><a href="{:url('admin/subscribereply/index')}">被关注回复</a></li>
            <li class=""><a href="{:url('admin/defaultreply/index')}">默认回复</a></li>
            <!-- <li class=""><a href="{:url('admin/subscribereply/poster')}">关注回复推广海报</a></li> -->
            <li class=""><a href="{:url('admin/defaultreply/add')}">添加关键词回复</a></li>
            <li class="layui-this">编辑关键词回复</li>
        </ul>
        <div class="layui-tab-content">
            <div class="title">关键词回复</div>
            <div class="reply-list">
                <div class="content">
                    <div class="auto-reply">自动回复</div>
                    <div class="tips">通过编辑内容或关键词规则，快速进行自动回复设置。如具备开发能力，可更灵活地使用该功能。
                        <br />关闭自动回复之后，将立即对所有用户生效。</div>
                    <form class="layui-form" action="{:url('admin/kw_reply/update',['id' => $kw_reply_info.id])}" method="post">
                        <div class="edit-reply">
                            <div class="layui-form-item">
                                <label class="layui-form-label">规则名称</label>
                                <div class="layui-input-block">
                                    <div style="width:calc(100% - 300px + 125px);">
                                        <input type="text" name="name" value="{$kw_reply_info.name}" required lay-verify="required" placeholder="输入规则名称" class="layui-input">
                                        <div class="remind">规则名最多60个字</div>
                                    </div>
                                </div>
                            </div>
                            {foreach name="$kw_reply_info.keyword_list_info" key="k" item="keyword"}
                            <div class="layui-form-item">
                                <label class="layui-form-label">关键词</label>
                                <div class="layui-input-block">
                                    <div style="width: 125px;display: inline-block;">
                                        <select name="match[]" lay-verify="required">
                                            <option value="contain" {eq name="keyword.match_mode" value="contain"}selected{/eq}>半匹配</option>
                                            <option value="equal" {eq name="keyword.match_mode" value="equal"}selected{/eq}>全匹配</option>
                                        </select>
                                    </div>
                                    
                                    <div class="keyword">
                                        <div class="kw-ipt">
                                            <input type="text" name="keyword[]" value="{$keyword.content}" required lay-verify="required" placeholder="输入关键词" class="layui-input">
                                        </div>
                                        {if condition="count($kw_reply_info.keyword_list_info) - 1 eq $k"}
                                        <div class="add-keyword" data-id = '1'>+</div>
                                        {else /}
                                        <div class="add-keyword" data-id = '2'>-</div>
                                        {/if}
                                    </div>
                                </div>
                            </div>
                            {/foreach}
                            <div class="layui-form-item">
                                <label class="layui-form-label">回复内容</label>
                                {foreach name="$kw_reply_info.reply_list_info" item="reply"}
                                    <div class="layui-input-block" style="line-height:38px;border-bottom: 1px solid #ccc;padding-bottom: 8px;width: calc(100% - 280px);">
                                        <input class="reply-ipt-type" type="hidden" name="type[]" value="{$reply.type}" />
                                        <input class="reply-ipt-content" type="hidden" readonly="readonly" name="content[]" value="{$reply.content}" />
                                        <span>{$reply.content}</span>
                                        <span class="reply-edit" style="color:#ccc;cursor:pointer;">编辑</span>&nbsp;&nbsp;<span class="reply-del" style="color:#ccc;cursor:pointer;">删除</span>
                                    </div>
                                {/foreach}
                                <div class="layui-input-block" style="display: flex;align-items: center;">
                                    <div class="reply-content-add" data-id = '1'>
                                        <div class="reply-content-change">
                                            <div>+</div>
                                        </div>
                                    </div>
                                    <div class="reply-content-blank">
                                        <div class="reply-content-type">
                                            <input type="radio" lay-filter="type" name="genre" value="news" title="图文消息">
                                            <input type="radio" lay-filter="type" name="genre" value="text" title="文字">
                                            <input type="radio" lay-filter="type" name="genre" value="img" title="图片">
                                            <input type="radio" lay-filter="type" name="genre" value="voice" title="语音">
                                            <input type="radio" lay-filter="type" name="genre" value="video" title="视频">
                                        </div>
                                    </div>
                                </div>
                                <!-- <div class="layui-input-block">
                                    <textarea name="content[]" placeholder="添加回复文字" class="layui-textarea"></textarea>
                                </div> -->
                            </div>
                            
                            <div class="layui-form-item">
                                <label class="layui-form-label">回复方式</label>
                                <div class="layui-input-block">
                                    <input type="radio" name="mode" value="reply_all" title="全部回复" {eq name="$kw_reply_info.mode" value="reply_all"}checked{/eq}>
                                    <input type="radio" name="mode" value="random_one" title="随机回复一条" {eq name="$kw_reply_info.mode" value="random_one"}checked{/eq}>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <div class="layui-input-block">
                                    <button class="layui-btn" lay-submit lay-filter="*">保存</button>
                                    <button type="reset" class="layui-btn layui-btn-primary">取消</button>
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
{/block}
{block name="js"}
<script src="__JS__/reply/main.js"></script>
<script src="__JS__/jquery.rotate.js"></script>
{/block}